//
//  UIView+HWCategory.h
//  OCDome
//
//  Created by 李含文 on 2020/10/10.
//  Copyright © 2020 李含文. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (HWCategory)

- (void)hw_addTapGesture:(void (^)(void))action;

//MARK:frame
@property (nonatomic) CGFloat left;        ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat x;        ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat top;         ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat y;         ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat right;       ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic) CGFloat bottom;      ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic) CGFloat width;       ///< Shortcut for frame.size.width.
@property (nonatomic) CGFloat height;      ///< Shortcut for frame.size.height.
@property (nonatomic) CGFloat centerX;     ///< Shortcut for center.x
@property (nonatomic) CGFloat centerY;     ///< Shortcut for center.y
@property (nonatomic) CGPoint origin;      ///< Shortcut for frame.origin.
@property (nonatomic, getter=frameSize, setter=setFrameSize:) CGSize size; ///< Shortcut for frame.size.

//MARK:transform
@property (nonatomic) CGFloat transformRotation;     ///< key path "tranform.rotation"
@property (nonatomic) CGFloat transformRotationX;    ///< key path "tranform.rotation.x"
@property (nonatomic) CGFloat transformRotationY;    ///< key path "tranform.rotation.y"
@property (nonatomic) CGFloat transformRotationZ;    ///< key path "tranform.rotation.z"
@property (nonatomic) CGFloat transformScale;        ///< key path "tranform.scale"
@property (nonatomic) CGFloat transformScaleX;       ///< key path "tranform.scale.x"
@property (nonatomic) CGFloat transformScaleY;       ///< key path "tranform.scale.y"
@property (nonatomic) CGFloat transformScaleZ;       ///< key path "tranform.scale.z"
@property (nonatomic) CGFloat transformTranslationX; ///< key path "tranform.translation.x"
@property (nonatomic) CGFloat transformTranslationY; ///< key path "tranform.translation.y"
@property (nonatomic) CGFloat transformTranslationZ; ///< key path "tranform.translation.z"

//MARK: 关联 SB 和 XIB
/** 圆角半径 */
@property (assign, nonatomic) IBInspectable CGFloat cornerRadius;
/** 边框宽度 */
@property (assign, nonatomic) IBInspectable CGFloat borderWidth;
/** 边框颜色 */
@property (weak, nonatomic) IBInspectable UIColor *borderColor;
/** 阴影弧度 */
@property (assign, nonatomic) IBInspectable CGFloat shadowRadius;
/** 阴影透明度 */
@property (assign, nonatomic) IBInspectable CGFloat shadowOpacity;
/** 阴影颜色 */
@property (copy, nonatomic) IBInspectable UIColor * _Nonnull shadowColor;
/** 阴影偏移量 */
@property (assign, nonatomic) IBInspectable CGSize shadowOffset;

/**
 快速给View添加圆角
 radius:圆角半径
 corners:且那几个角
 类型共有以下几种:
 typedef NS_OPTIONS(NSUInteger, UIRectCorner) {
 UIRectCornerTopLeft,
 UIRectCornerTopRight ,
 UIRectCornerBottomLeft,
 UIRectCornerBottomRight,
 UIRectCornerAllCorners
 };
 使用案例:[self.mainView addRounded:10 corners:UIRectCornerBottomLeft | UIRectCornerBottomRight]; // 切除了左下 右下
 */
- (void)addRounded:(CGFloat)radius corners:(UIRectCorner)corners;

/// 添加圆角带黑色阴影
/// @param radius 圆角值
/// @param opacity 阴影不透明度
- (void)addRounded:(CGFloat)radius shadow:(CGFloat)opacity;
/// 快速加载xib
+ (id)hw_loadViewFromNib;
/// 可以获取到父容器的控制器的方法,就是这个黑科技.
- (UIViewController *)hw_viewController;
@end

NS_ASSUME_NONNULL_END
